const mongoose = require('mongoose')

const imageSchema = new mongoose.Schema({
  title: {
    type: String, maxlength: 128,
    required: true, minlength: 3
  },
  description: {
    type: String,
    required: true,
    maxlength: 1024
  },
  originalname: {
    type: String,
    required: true,
    maxlength: 128
  },
  mimetype: {
    type: String, 
    enum: ['image/jpeg', 'image/png'],
    required: true
  },
  diskfilename: {
    type: String,
    required: true
  }
}, {timestamps: true})

mongoose.model('Image', imageSchema, 'images')